﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using log4net;

namespace RecommenderSystem.misc
{
    public class ImplDataRecord : IDataRecord
    {
        private Dictionary<String, String> dataRecord = null;
//        private static ILog logger = log4net.LogManager.GetLogger(typeof(ImplDataRecord));
        
        public ImplDataRecord()
        {
            dataRecord = new Dictionary<string,string>();
        }


        public void setData(String key, String value)
        {
            if (key== null | value==null)
            {
//                logger.Warn(key+ ": "+ value+ " not inserted because one of this values is null");
                return;
            }

            dataRecord.Add(key, value);
        }




        public String getData(String key)
        {
            if (key == null)
            {
//                logger.Warn("Key is null");
                return null;
            }
            String data ="";
            dataRecord.TryGetValue( key, out data );
            return data;

        }

        public String getUserID() { return this.getData(Config.USER_ID); }
        public String getItemID() { return this.getData(Config.ITEM_ID); }
        public String getItemRank() { return this.getData(Config.ITEM_RANK); }
    }
}
